package cn.infinite.security.http;

import org.springframework.security.web.PortResolver;
import org.springframework.security.web.savedrequest.DefaultSavedRequest;
import org.springframework.security.web.savedrequest.SavedRequest;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Map;

public class AsyncRefererSavedRequest extends DefaultSavedRequest implements SavedRequest {

    private String savedUrl;

    public AsyncRefererSavedRequest(HttpServletRequest request, PortResolver portResolver, String savedUrl) {
        super(request, portResolver);
        this.savedUrl = savedUrl;
    }

    @Override
    public String getRedirectUrl() {
        return this.savedUrl;
    }

    @Override
    public List<Cookie> getCookies() {
        return super.getCookies();
    }

    @Override
    public String getMethod() {
        return super.getMethod();
    }

    @Override
    public List<String> getHeaderValues(String name) {
        return super.getHeaderValues(name);
    }

    @Override
    public Collection<String> getHeaderNames() {
        return super.getHeaderNames();
    }

    @Override
    public List<Locale> getLocales() {
        return super.getLocales();
    }

    @Override
    public String[] getParameterValues(String name) {
        return super.getParameterValues(name);
    }

    @Override
    public Map<String, String[]> getParameterMap() {
        return super.getParameterMap();
    }
}
